/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package kernel;

/**
 *
 * @author coco
 */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectDB {

private static Connection conn;

  public static Connection ConnectDB(){
              //Function to connect
        try {
            //Load the driver for MYSQL
            Class.forName("com.mysql.jdbc.Driver");
                //        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }catch(ClassNotFoundException e){
            e.printStackTrace();
        }
        try{
            //Connect to Database
            System.out.println("ici");

            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/autovermietung","root","");
            System.out.println("Connexion parfaite mon general");
            return conn;
        }
        catch(SQLException e) {
                        e.printStackTrace();
                        return null; 
        }
    }
    
}
